21 Dec 2025

feedDrupal.org aggregator

#! code: Drupal 11: Controlling LED Lights Using A REST Service

Drupal 11: Controlling LED Lights Using A REST Service

Following on from my article looking at the Pimoroni Plasma 2350 W I decided to do something interesting with the Wifi interface that would connect to a Drupal site.

The firmware of the Plasma 2350 W from Pimoroni comes with an example that connects to a free API to update the colour randomly. Once I saw this in action I realised that it shouldn't be too hard to convert that to pull the data from a Drupal REST service instead.

It is quite easy to create RESTful services in Drupal; it just needs a single class. All I would need to do is create a form to control the colour that is selected in the REST service.

In this article we will look at creating a Drupal module containing a RESTful interface, which we will connect to with the Plasma 2350 W to update the colour of the lights.

Setting Up The Form

In order to allow the colour of the LED lights to be set I needed to create a form that would do just that.

To save the colour to the system we will use the state service, which is a handy little key/value service that allows us to write simple values to the database. This service is a good way of storing values that aren't part of the Drupal configuration system. Ideally, you want values that can be easily recreated by the system if they don't already exist. The colour setting is therefore an ideal candidate for the state service.

Setting the form up with this service injected is simple enough, but we can also simplify the form integration by abstracting away the get and set methods for the state itself.

This is what the basic structure of the form class looks like.

philipnorton42

21 Dec 2025 6:46pm GMT

Freelock Blog: Can You Adjust the Spacing? Text Flexibility

Day 21 - Text Flexibility


You're reading a website, but the text feels cramped. Lines are too close together, making it hard to track from one line to the next. Words blur together. You try increasing your browser's font size, but that only makes part of the problem worse - now the text is bigger but still squished together.

If you could just add a little more space between lines, between words, between letters... you'd be able to read comfortably. But when you try using a browser extension to adjust spacing, the layout breaks. Text gets cut off. Paragraphs overlap. Buttons disappear.

Read More

21 Dec 2025 4:30pm GMT

feedSymfony Blog

A Week of Symfony #990 (December 15–21, 2025)

This week, we published an article about how we controlled 1,200 screens in real time with Symfony during SymfonyCon Amsterdam 2025. We also celebrated a new SymfonyCasts course on building Symfony bundles. Finally, we shared a blog post detailing 20 years…

21 Dec 2025 8:27am GMT

20 Dec 2025

feedDrupal.org aggregator

Freelock Blog: Can You Skip the Navigation? Bypass Blocks

Day 20 - Bypass Blocks


Imagine navigating a website with only your keyboard. You hit Tab to move through interactive elements. First tab: logo link. Second tab: search box. Third tab: first navigation link. Fourth, fifth, sixth tabs: more navigation links. Seventh tab: social media icons. Eighth tab: language selector. Finally, after nine or ten tab presses, you reach the actual content of the page.

Now imagine doing this on every single page you visit. Every. Single. Time.

Read More

20 Dec 2025 4:30pm GMT

18 Dec 2025

feedSymfony Blog

20 Years of Symfony in Code Stats

In 2025, we're celebrating 20 years of Symfony. Over these years, thousands of people have contributed code to Symfony. Some folks fixed a small typo in a comment, while others added more than 100,000 lines of code. All contributions are welcome and essential…

18 Dec 2025 11:38am GMT

17 Dec 2025

feedSymfony Blog

New SymfonyCasts Course: Bundle Development

Symfony bundles are one of the framework's most powerful ideas: reusable, shareable building blocks that let you package features once and use them everywhere. But building a great bundle is very different from building an application. It's an area that many…

17 Dec 2025 1:43pm GMT